<template>
  <div class="zy-step">
    <div class="step-box">
      <div class="item" v-for="(item, index) of dataSource" :key="index">
        <div
          class="line"
          :class="{ cur: item.checked }"
          v-if="index !== dataSource.length - 1 && dataSource.length != 2"
        ></div>
        <div
          class="line2"
          :class="{ cur: item.checked }"
          v-if="index !== dataSource.length - 1 && dataSource.length == 2"
        ></div>
        <van-icon
          class="img"
          :class="{ cur1: item.checked }"
          v-if="item.checked"
          name="checked"
          size="18"
        />
        <van-icon class="img" v-if="!item.checked" name="passed" size="18" />
        <div class="name" :class="{ cur1: item.checked }">
          {{ item.name }}
        </div>
      </div>
    </div>
    <slot></slot>
  </div>
</template>

<script>
export default {
  props: {
    title: {
      type: String,
    },
    dataSource: {
      type: Array,
    },
  },
};
</script>
<style lang="less" scoped>
.zy-step {
  width: 100%;
  min-height: 160px;
  background: #f9f9f9;
  padding: 25px 0;
  .step-box {
    display: flex;
    width: 100%;
    margin: 20px 0;
    // overflow: hidden;
    justify-content: space-around;
    .item {
      position: relative;
      display: flex;
      flex: 1;
      align-items: center;
      flex-direction: column;
    }
    .img {
      width: 30px;
      height: 30px;
      vertical-align: middle;
      color: #969799;
    }
    .line {
      position: absolute;
      top: 14px;
      left: 125px;
      width: 123px;
      border-bottom: 3px solid #969799;
    }
    .line2 {
      position: absolute;
      top: 14px;
      left: 220px;
      width: 315px;
      border-bottom: 3px solid #969799;
    }
    .name {
      margin-top: 25px;
      font-size: 22px;
      font-weight: 400;
      line-height: 20px;
      color: #969799;
    }
    .cur {
      border-bottom: 3px solid #ffb72f;
    }
    .cur1 {
      color: #ffb72f;
    }
  }
}
</style>
